package VN.EDU.IMIC.DEVELOPER.TRANTHITHANHNGA.EXCEPTION;
/* try statement can be nested inside another block of try. 
 * Nested try block is used when a part of a block may cause one error while entire block may cause another error. 
 * In case if inner try block does not have a catch handler for a particular exception then the outer try is checked for match.
 * 
 */
public class NestedExcp {
	public static void main(String[] args) {
		try {
			int arr[] = { 5, 0, 1, 2 };
			try {
				int x = arr[3] / arr[1];
			} catch (ArithmeticException ae) {
				System.out.println("divide by zero");
			}
			arr[4] = 3;
		} catch (ArrayIndexOutOfBoundsException e) {
			System.out.println("array index out of bound exception");
		}
	}
}
